import request from "@/utils/request";
import type {Conversations, PrivateMessageSaveDTO,ConversationInfoVO,PrivateMessage} from "@/api/social/chat/type";

enum API {
    PRIVATE_MESSAGE="/social/chat/private-message",
    CONVERSATION_LIST="/social/chat/private-message/conversation-list",
    PRIVATE_MESSAGE_LIST_BY_CONVERSATION_ID="/social/chat/private-message/list/by/conversation",
}

export function reqSendPrivateMessage(data: PrivateMessageSaveDTO){
    return request({
        url: API.PRIVATE_MESSAGE,
        method: "post",
        data,
    });
}
export function reqGetUserConversationList(){
    return request<ConversationInfoVO[]>({
        url: API.CONVERSATION_LIST,
        method: "get",
    });
}
export function reqGetPrivateMessageListByConversationId(conversationId:number){
    return request<PrivateMessage[]>({
        url: `${API.PRIVATE_MESSAGE_LIST_BY_CONVERSATION_ID}/${conversationId}`,
        method: "get",
    });
}
